1. Field of the Invention
The present invention relates to a method and system for detecting whether or not an optical system is in focus.
2. Description of the Prior Art
In one example of a conventional focus detection system, light beams at different portions of the light radiated by or reflected from an object are incident through a lens on, for example, two photosensor arrays. Proper focus, or the "focused condition," can be detected from the relative displacement between the two images of the object which are formed on the two photosensor arrays. This technique is disclosed, for example, in U.S. Pat. Nos. 4,004,852 and 4,412,741.
In order to improve the accuracy in focus detection, it is necessary to accurately obtain the amount of image deviation between the two images formed on the two photosensors. In the focused condition, this amount is zero, i.e., the two images coincide with each other. It is, however, not possible to directly obtain the amount of image deviation with an accuracy and a resolution higher than the accuracy and resolution determined by the geometrical arrangement (pitch) of the photosensors. Consequently, an approach has been used in which the amount of image deviation is obtained at the accuracy of the photosensor pitch, and then the deviation thus-obtained is used to perform an interpolation computation, so that the resulting image deviation amount has an accuracy higher than that determined by the pitch of the photosensors. This approach is disclosed in Japanese Patent Application Laid-open No. 60-37,513 (which is related to U.S. Pat. No. 4,561,749, issued Dec. 31, 1985), and will now be explained.
FIG. 3 is a block diagram showing an example of a conventional focus detection system. FIGS. 4A-4C provide an explanation of the interpolation method.
In FIG. 3, reference numerals 1A and 1B denote photosensor arrays, each having a plurality of sensors arrayed at equal intervals (pitch). Light from an object is directed through an optical system (not shown) and impinges on the photosensors 1A and 1B to form images of the object. The amount of a relative displacement X between these images can be used to generate a signal representing an in focus condition or an out of focus condition. That is, one image falls on photosensor array 1A at a particular position relative to array 1A and the other image falls on photosensor array 1B at a particular position relative to array 1B, and the particular positions relative to the respective arrays will be displaced by a distance or amount X unless the optical system is in focus (in which case X=0, and the position of the first image relative to array 1A is the same as the position of the second image relative to array 1B). Reference numerals 2A and 2B denote analog/digital converters (A/D converters) which convert analog outputs from the respective sensors in the photosensor arrays 1A and 1B into digital signals. Reference numeral 3 denotes a computation processing unit such as a microcomputer which receives the digital signals from the A/D converters 2A and 2B to calculate the amount of relative displacement X between the two images. The position of a field lens (not shown) is adjusted in accordance with this value X. In this manner, a conventional focus detection system is generally arranged by using a computation processing unit.
Assuming that photosensor array 1A is positioned to the left and that photosensor array 1B is positioned to the right, and that array 1A has a row of M1 sensors and array 1B has a row of M2 sensors, the output signals from the sensors in array 1A can be conveniently represented as L(1), L(2), . . . , L(M1) while the output signals from the sensors in array 1B are represented as R(1), R(2), . . . , R(M2). If the relative displacement amount is zero, indicating that the optical system is in focus, L(1) will equal R(1), L(2) will equal R(2), and so on. On the other hand the optical system might be focussed too near or too far, so that the pattern of output signals from one array would be shifted relative to the pattern of output signals from the other array. For example, if the relative displacement amount X is such that the image impinging on array 1B is shifted to the left by precisely the width of one sensor, with respect to the image impinging on array 1A, L(1) would equal R(2), L(2) would equal R(3), and so forth. For images that are shifted by an integral multiple of the pitch p of the arrayed photosensors, the amount of relative displacement X between the two images is given by X=i.p, where i is an integer representing the number of photosensors by which the image falling on one array has been shifted with respect to the image falling on the other array. Thus, the relative displacement amount X can be found, to an accuracy which depends on the photosensor pitch p, by determining how far (in terms of the number of photosensors) the pattern of output signals from one array must be shifted in order to best match the pattern of output signals from the other array. The best match can be found using an evaluation function f(i) which represents the degree of inconsistency between the two images for a range of possible values of the shift amount.
An evaluation function f(i) is defined as follows: ##EQU1## In equation (1), j is an integer representing a photosensor position in both arrays. For example, j=0 identifies the 0th photosensor in both arrays, j=1 identifies photosensor number one in both arrays, and so on. The number i is an integer representing a shift amount, or the difference between a photosensor position in one array and a photosensor position in the other array. For example, i=2 designates a relative photosensor position in one array that spaced two photosensors apart from the corresponding relative photosensor position in the other array. It will be apparent that, for given values of the shift amount i, equation (1) represents a comparison of the pattern of output signals from one of the left photosensor array with the pattern of output signals from the right photosensor array on a sensor-by-sensor basis. The integer i can be positive or negative, corresponding to the optical system being focused too near or too far. After equation (1) is evaluated for different values of i in a predetermined range (which includes the focused condition where i=0), the minimum value of f(i) is selected as the best match between the patterns of output signals. The value i.sub.0 is defined to be the value of i that gives the minimum value of f(i).
If the relative displacement between the two images on the photosensor arrays 1A and 1B is i.sub.0 .times.p, then f(i.sub.0)=0. However, normally, it is rare that X is exactly an integral multiple of the photosensor pitch p, or that the shapes of the image signals coming from the two photosensors are identical with each other (apart from the relative displacement between the two images), so that usually f(i)&gt;0.
A microcomputer can easily perform the processing to find the minimum value of f(i), i.e., the true amount of relative displacement over the range i=-N.sub.1, ---, +N.sub.2. This computation, however, is merely a first-order approximation, as described above, so that interpolation is necessary to perform more accurate detection.
FIG. 4A shows a conventional example of this interpolation method.
With reference to FIG. 4A, it will be recalled that i.sub.0 is the value of i that gives the minimum value of f(i) for amounts of relative displacement indicated by i (an integer) x p, and it is assumed that: EQU f(i.sub.-1)&gt;f(i.sub.+1) (2)
The inequality relatonship (2) indicates that the true image deviation amount lies between i.sub.0 and i.sub.+1. When f(i.sub.-1)&lt;f(i.sub.+1), i.sub.-1 and i.sub.+1 are reversed in relationship (2) and then the same procedure is followed. Note that i.sub.-1 .tbd.i.sub.0 -1 and i.sub.+1 .tbd.i.sub.0 +1.
In the conventional interpolation method shown in FIG. 4A, a straight line L.sub.0 is first drawn to link the point (i.sub.-1, f(i.sub.-1)) with the point (i.sub.0, f(i.sub.0)). Then, a straight line L.sub.1 having a slope, the absolute value of which is equal to that of the straight line L.sub.0 and which has a sign opposite to that of the line L.sub.0, is drawn through the point (i.sub.+1, f(i.sub.+1)). Then, the interpolated value I =X/p of the abscissa of the point where the straight lines L.sub.0 and L.sub.1 intersect is the final image deviation amount obtained by interpolation.
This interpolation method provides a correct value of X when f(i) is in the form of straight lines like the straight lines L.sub.0 and L.sub.1 shown in FIG. 4A. However an error will occur when, as shown in FIG. 4B and FIG. 4C, f(i) has curvature. That is, if a straight line L.sub.2 having a slope of the same absolute value as that of the straight line L.sub.0 and with a sign opposite to that of the line L.sub.0, as shown by the broken lines in FIG. 4B and FIG. 4C, is drawn through a point (X.sub.0/p +(X.sub.0/p -i.sub.0), f(i.sub.0)) which is symmetrical to the point (i.sub.0, f(i.sub.0)) with respect to the straight line i=X.sub.0/p, then the point of intersection between the lines L.sub.0 and L.sub.2 gives the correct value for the real image deviation amount X.sub.0. This is because f(i) is symmetrical with respect to the straight line i=X.sub.0/p, at least in the vicinity of X.sub.0. But, as shown by the dash-and-dot line L.sub.1 in FIGS. 4B and 4C, the actual line L.sub.1 passes through a point other than the point (X.sub.0/p +(X.sub.0/p -i.sub.0), f(i.sub.0)). Accordingly, as is clear from FIGS. 4B and 4C, when the curve f(i) is downwards convex, as in FIG. 4B, X&gt;X.sub.0. When the curve f(i) is upwards convex, as in FIG. 4C, X&lt;X.sub.0.
This error results from the fact that the absolute value of the slope is fixed to f(i.sub.-1)-f(i.sub.0), and the fact that this slope value itself is applied to the straight lines L.sub.0 and L.sub.1 in FIG. 4A.
As is clear from the above description, the conventional interpolation method results in a comparatively large error between the image deviation amount obtained by the interpolation and the true image deviation amount. Hence, there is a problem in that the image deviation amount cannot be obtained with satisfactory accuracy.